﻿using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Pay.DTO;
using Pay.TO;

namespace Pay.IService {
	public interface IProductService {
		/// <summary>
		/// 查询商品列表
		/// </summary>
		/// <param name="goodsQuery"></param>
		/// <returns></returns>
		PagedResult<product_dto> Get(GoodsQuery goodsQuery);
        /// <summary>
        /// 专用分销后台
        /// </summary>
        /// <param name="goodsQuery"></param>
        /// <returns></returns>
        PagedResult<product_dto> GetForDistributionHt(GoodsQuery goodsQuery);
        /// <summary>
        /// 查询商品列表(含处理活动)
        /// </summary>
        /// <param name="goodsQuery"></param>
        /// <returns></returns>
        PagedResult<product_dto> GetForActicity(GoodsQuery goodsQuery);
        /// <summary>
        /// 是否已分销商品
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        bool IsShareProduct(distribution_goods_query query);

        /// <summary>
        /// 获取店铺商品数据
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        PagedResult<product_shop_dto> GetShopGoods(GoodsQuery query);
        /// <summary>
        /// 查询单个商品，包括促销活动，价格随活动价变化
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        product_dto Get(long id);
        /// <summary>
        /// 获得产品详情（含活动处理）
        /// </summary>
        /// <param name="id"></param>
        /// <param name="isIncludePreHeat">是否包含预热</param>
        /// <param name="isOnlyCashPay">仅使用现金支付</param>
        /// <returns></returns>
        product_dto GetForActicity(long id, bool isIncludePreHeat = false, bool isOnlyCashPay = false);
        /// <summary>
        /// 同类商品
        /// </summary>
        /// <param name="categroyId"></param>
        /// <param name="productId"></param>
        /// <returns></returns>
        List<product_dto> GetLikeProducts(long categroyId, long productId);
        /// <summary>
        /// 获得产品规格详情（含活动处理）
        /// </summary>
        /// <param name="skuId"></param>
        /// <param name="isIncludePreHeat">是否包含预热</param>
        /// <param name="isOnlyCashPay">仅使用现金支付</param>
        /// <returns></returns>
        product_sku_dto GetSkuForActivity(long skuId, bool isIncludePreHeat = false, bool isOnlyCashPay = false);
        /// <summary>
        /// 获得产品扩展（用于分润计算）详情（含活动处理）
        /// </summary>
        /// <param name="productId"></param>
        /// <param name="skuId"></param>
        /// <param name="isIncludePreHeat"></param>
        /// <param name="isOnlyCashPay">仅使用现金支付</param>
        /// <returns></returns>
        product_calculate_ex GetCalculateExForActivity(long productId, long skuId = 0, bool isIncludePreHeat = false, bool isOnlyCashPay = false);
        /// <summary>
        /// 购物车的商品集合请求返回最新价格、商品名称、图片、单价、市场价、卖家编号、是否可以购买
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        ApiResultMessage Cart(cart_req_model dto);
		/// <summary>
		/// 校验商品价格
		/// </summary>
		/// <param name="dto"></param>
		/// <returns></returns>
		ApiResultMessage ValidProduct(cart_req_model dto);
		/// <summary>
		/// 新增商品
		/// </summary>
		/// <param name="dto"></param>
		/// <returns></returns>
		int Add(product_dto dto, bool is_from_supplierpc = false);
		/// <summary>
		/// 新增或编辑商品
		/// </summary>
		/// <param name="dto"></param>
		/// <returns></returns>
		ApiResultMessage Save(product_model dto);
        /// <summary>
        /// 保存候鸟商品
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        ApiResultMessage SaveHniaoProduct(product_model dto);
        /// <summary>
        /// 编辑商品
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        int Update(product_dto dto, bool is_from_supplierpc = false);
		/// <summary>
		/// 商品审核
		/// </summary>
		/// <param name="dto"></param>
		/// <returns></returns>
		int Audit(long id, AuditStatus audit_status, string audit_reason);
		/// <summary>
		/// 删除商品
		/// </summary>
		/// <param name="id"></param>
		/// <returns></returns>
		int Delete(long id);
		/// <summary>
		/// 上下架：返回1下架，2上架
		/// </summary>
		/// <returns>The down.</returns>
		/// <param name="id">Identifier.</param>
		int UpDown(long id);
		ApiResultMessage DeleteProduct(long id);
        void MinusStock(Data.Order order, List<string> cacheList = null);
        /// <summary>
        /// 编辑商品分类
        /// </summary>
        /// <param name="productId"></param>
        /// <param name="categoryId"></param>
        /// <returns></returns>
        int EditProductCategory(long productId, long categoryId);
        /// <summary>
        /// token 保存商品
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        bool SaveTokenProduct(token_product_dto model);
        /// <summary>
        /// token 获取商品
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        token_product_dto GetTokenProduct(long id);

        #region 拓垦商城-商品管理
        /// <summary>
        /// 拓垦节点商城-商品管理列表
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        PagedResult<token_product_manage_dto> GetTokenProductManageList(TokenProductQuery query, bool isFromSupplierPC = false);
        /// <summary>
        /// 变更拓垦商城-商品管理状态
        /// </summary>
        /// <param name="product_id"></param>
        /// <param name="distribution_product_id"></param>
        /// <param name="is_proprietary"></param>
        /// <param name="status">状态（1：上架，2：下架，3：删除）</param>
        /// <returns></returns>
        bool UpdateTokenProductStatus(long product_id, long distribution_product_id, bool is_proprietary, int status, long merchant_id);
        /// <summary>
        /// 获取商品规格
        /// </summary>
        /// <param name="product_id"></param>
        /// <param name="sku_path"></param>
        /// <returns></returns>
        product_sku_dto GetSku(long product_id, string sku_path);
        #endregion

        Task<product_sku_info> SearchSkuInfo(string sku);
        int SaveProductSku(product_sku_info dto);
        /// <summary>
        /// 获取候鸟商品sku数据
        /// </summary>
        /// <param name="goodsQuery"></param>
        Task<int> GetProductSkus(GoodsQuery goodsQuery);
    }
}
